<?php
/********************************************************************
 *	Author:
 *		Jestery Liu <jestery@gmail.com>
 *		http://www.pte.cn
 *
 *	File:			Instances.class.php
 *	Create Date:	2006-12-26 13:43:42 CST
 *******************************************************************/
class Instances
{
	public static $instances = array();

	private function __construct() {}

	public static function get($name)
	{
		return is_object(self::$instances[$name]) ? self::$instances[$name] : null;
	}

	public static function put($object, $name=null)
	{
		if (is_object($object))
		{
			if ($name == null)
				$name = get_class($object);
			self::$instances[$name] = $object;
			return true;
		}
		else
		{
			return false;
		}
	}
}

/* vim: set ts=4 sw=4 ff=unix: */
